<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['share_manual']) && ($_SESSION['share_manual'] <= 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intStatus		= $objRequest->getParam('stt', -1);
$intAdv			= $objRequest->getParam('adv', -1);
$strOption		= $objRequest->getParam('opt', '');
$strKey			= $objRequest->getParam('key', '');
$strStart		= $objRequest->getParam('startdate', '');
$strEnd			= $objRequest->getParam('enddate', '');
$intPage		= $objRequest->getParam('page', 1);
$intCancel		= $objRequest->getParam('pcancel', 0);
$intLimit		= $variable['ADMIN_LIMIT']['val'];
$intOff			= (($intPage-1) * $intLimit);
$intTotal		= 0;
$objSmanual		= new Smanual(); 
if($intCancel) {
	if(isset($_SESSION['SHARE_MANUAL_SEARCH'])) unset($_SESSION['SHARE_MANUAL_SEARCH']);
	if(isset($_SESSION['SHARE_MANUAL_CANCEL'])) unset($_SESSION['SHARE_MANUAL_CANCEL']);
	unset($strStart);
	unset($strEnd);
	unset($strOption);
	unset($strKey);
}
$arrResult		= $objSmanual->getAll($AppUI->type, 
									  $intStatus, 
									  $strOption, 
									  $strKey, 
									  Ecore_Function::convertStrToDate($strStart), 
									  Ecore_Function::convertStrToDate($strEnd), 
									  $intOff, 
									  $intLimit, 
									  $intTotal);
if($strOption != 0 || $strKey != '' || $strStart != '' || $strEnd != '') {
	$_SESSION['SHARE_MANUAL_CANCEL'] = 1;	
	$_SESSION['SHARE_MANUAL_SEARCH'] = $objRequest->getParams();
}
else {
	if(isset($_SESSION['SHARE_MANUAL_SEARCH'])) unset($_SESSION['SHARE_MANUAL_SEARCH']);
	if(isset($_SESSION['SHARE_MANUAL_CANCEL'])) unset($_SESSION['SHARE_MANUAL_CANCEL']);
}
# list
$this->view->arrResult		= $arrResult;
$this->view->intTotal		= $intTotal;
$this->view->intOffset		= $intOff;
$this->view->intLimit		= $intLimit;
$this->view->arrOption		= $arrOption;
$this->view->strUrl			= Ecore_Function::getUrl(HOST_BACKEND);
$this->view->arrStatus		= ($AppUI->type == ROOT_ROLE) ? $arrStatusAd : $arrStatus;
$this->view->intStatus		= $intStatus;